package com.ss2;

/**
 * @Auther: 520ljs
 * @Date: 2022/3/10 - 03 - 10 - 17:34
 */
public class Student {
    //属性：
    private int age;
    private String name;
    private String sex;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setSex(String sex) {
        if ("男".equals(sex) || "女".equals(sex) || "girl".equals(sex)) {//sex是男 或者 是 女
            this.sex = sex;
        } else {
            this.sex = "男";
        }
    }

    public String getSex() {
        return sex;
    }

    //加入构造器：
    public Student() {

    }

    public Student(int age, String name, String sex) {
        this.age = age;
        this.name = name;
        //this.sex = sex;
        this.setSex(sex);
    }
}
